package org.example.compile;

import com.sun.jna.Library;
import com.sun.jna.Native;

import java.io.*;

public class Test {
//    public interface Sum extends Library{
//        //动态库接口
//        int sum();
//
//        //创建动态库实例
//        Sum INSTANCE = (Sum) Native.loadLibrary("sum", Sum.class);
//    }
//    static
//    {
//        File file=new File("C:\\Users\\topto\\Desktop\\a.ddl");
//        System.load(file.getAbsolutePath());
//    }

    public static void main(String[] args) throws Exception {
        String[] cmd={"C:\\Users\\topto\\Desktop\\a.exe"};
        Process exec = Runtime.getRuntime().exec(cmd);
        OutputStream outputStream = exec.getOutputStream();
        BufferedWriter bufferedWriter=new BufferedWriter(new OutputStreamWriter(outputStream));
        bufferedWriter.write("");
        bufferedWriter.close();
        outputStream.close();
        InputStream is=exec.getInputStream();
        InputStreamReader isr=new InputStreamReader(is,"GBK");
        BufferedReader br=new BufferedReader(isr);
        String line=br.readLine();
        while(line!=null){
            System.out.println(line);
            line=br.readLine();
        }

        }
}
